home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / snip0493.zip / FTIME.C < prev    next >
C/C++ Source or Header  |  1993-04-05  |  1KB  |  59 lines

  1. /*
  2. **  Public domain by Jeff Dunlop & Bob Stout
  3. */
  4.  
  5. #ifndef __TURBOC__
  6.  
  7. #include <dos.h>
  8. #include "ftime.h"
  9.  
  10. #ifdef __ZTC__
  11.  #pragma ZTC align 1
  12.  #define DOS_GETFTIME dos_getftime
  13.  #define DOS_SETFTIME dos_setftime
  14. #else
  15.  #pragma pack(1)
  16.  #define DOS_GETFTIME _dos_getftime
  17.  #define DOS_SETFTIME _dos_setftime
  18. #endif
  19.  
  20. int _cdecl getftime (int handle, struct ftime *ftimep)
  21. {
  22.       int retval = 0;
  23.       union
  24.       {
  25.             struct
  26.             {
  27.                   unsigned time;
  28.                   unsigned date;
  29.             } msc_time;
  30.             struct ftime bc_time;
  31.       } FTIME;
  32.  
  33.       if (0 == (retval = DOS_GETFTIME(handle, &FTIME.msc_time.date,
  34.             &FTIME.msc_time.time)))
  35.       {
  36.             *ftimep = FTIME.bc_time;
  37.       }
  38.       return retval;
  39. }
  40.  
  41. int _cdecl setftime (int handle, struct ftime *ftimep)
  42. {
  43.       union
  44.       {
  45.             struct
  46.             {
  47.                   unsigned time;
  48.                   unsigned date;
  49.             } msc_time;
  50.             struct ftime bc_time;
  51.       } FTIME;
  52.  
  53.       FTIME.bc_time = *ftimep;
  54.  
  55.       return DOS_SETFTIME(handle, FTIME.msc_time.date, FTIME.msc_time.time);
  56. }
  57.  
  58. #endif /* __TURBOC__ */
  59.